#include <stdio.h>
#include <stdlib.h>
#include <string.h>

enum angle {
    positive_angle = 1, /* ni shizhen xuanzhuang */
    negative_angle = 2  /* shun shizhen xuangzhuang */
};

void zhengjiao(int jiao, enum angle ac)
{
    if (ac == positive_angle) {
        printf("positive angle is: %d\n", jiao);
    }
    else {
        printf("not positive angle.\n");
    }
}

void fujiao(int jiao, enum angle ac)
{
    if (ac == negative_angle) {
        printf("negative angle is: -%d\n", jiao);
    }
    else 
        printf("not negative angle.\n");
}

/*
 * S = { B | B = a + k * 360, k -> Z}
 */
void renyijiao(int jiao)
{
    
}

void main(int argc, char **argv)
{
    enum angle ac;
    int jiao;
    int i;
    char data[32] = {0};

    if (argc <= 1) {
        printf("parameter error, pargram exit\n");
        exit(0);
    }

    if (argv[1][0] == '-') {
        ac = positive_angle;
        for (i = 1; i < strlen(argv[1]); i++) {
            data[i-1] = argv[1][i];
        }
        // printf("data is %s\n", data);
        zhengjiao(atoi(data), ac);
    } 
    else {
        ac = negative_angle;
        fujiao(atoi(argv[1]), ac);
    }

    switch (ac) {
    case positive_angle:
        printf("positive angle.\n");
        break;
    case negative_angle:
        printf("negative angle.\n");
        break;
    default:
        printf("zero angle.\n");
    }
    
}
